function Intro() {
  
  this.page = 0;
  
  this.introPosition = 0;
  this.introX = 0;
  this.introPositionsX = [960, 0, -888, -1750, -2616, -2616];
  this.introTransition = 0;
  this.INTRO_TRANSITION_TIME = 1; //40;
  
  
  this.init = function() {
    this.registerTitleScreenAreas();
    this.page = 0;
  };
  
  
  this.registerTitleScreenAreas = function() {
    mouse.registerUpArea("startGame", 755, 487, 155, 30, function() {
      sound.play("button");
      intro.deleteTitleScreenAreas();
      intro.page = 1;
      intro.registerIntroAreas();
    });
    
    mouse.registerUpArea("credits", 798, 527, 112, 30, function() {
      sound.play("button");
      intro.deleteTitleScreenAreas();
      intro.page = 2;
      intro.registerCreditsAreas();
    });
  };
  
  
  this.deleteTitleScreenAreas = function() {
    mouse.deleteUpArea("startGame");
    mouse.deleteUpArea("credits");
  };
  
  
  this.registerIntroAreas = function() {
    this.introX = this.introPositionsX[0];
    this.introPosition = 1;
    this.introTransition = this.INTRO_TRANSITION_TIME;
    mouse.registerUpArea("nextFrame", 0, 0, 960, 600, function() {intro.actionNext();});
  };
  
  
  this.actionNext = function() {
    
    if(intro.introTransition == 0) {
      sound.play("button");
      intro.introPosition++;
      if(intro.introPosition == 5) {
        intro.deleteIntroAreas();
        game.startTransition(function() { 
          game.switchState(Game.INGAME_STATE);
        });
      } else {
        intro.introTransition = intro.INTRO_TRANSITION_TIME;
      }
    }
  };
  
  
  this.deleteIntroAreas = function() {
    mouse.deleteUpArea("nextFrame");
  };
  
  
  this.registerCreditsAreas = function() {
    mouse.registerUpArea("back", 820, 527, 90, 30, function() {
      sound.play("button");
      intro.deleteCreditsAreas();
      intro.page = 0;
      intro.registerTitleScreenAreas();
    });
  };
  
  
  this.deleteCreditsAreas = function() {
    mouse.deleteUpArea("back");
  };
  
  
  this.update = function() {
    if(this.introTransition > 0) {
      this.introTransition--;
      var lastX = this.introPositionsX[intro.introPosition - 1];
      var deltaX = this.introPositionsX[intro.introPosition] - lastX;
      this.introX = lastX + (deltaX * 0.5 * (1 + Math.sin(1.5708 - (3.1416 * (this.introTransition / this.INTRO_TRANSITION_TIME)))));
    } else {
      this.introX = this.introPositionsX[intro.introPosition];
    }
  };
  
  
  this.draw = function() {
    
    if(this.page == 1) {
      
      c.fillStyle = "#fff";
      c.fillRect(0, 0, game.width, game.height);
      
      if(this.introX > 0) {
        img.draw("title", this.introX - 960, 0);
        img.drawSprite("menu", this.introX - 210, 482, 160, 40, 0, 0);
        img.drawSprite("menu", this.introX - 210, 522, 160, 40, 0, 1);
      }
      img.draw("intro", this.introX, 0);
      if(this.introTransition == 0 && intro.introPosition < 5) {
        if(mouse.isOver(840, 520, 50, 36)) {
          img.drawSprite("arrow", 840, 520, 50, 36, 0, 1);
        } else {
          img.drawSprite("arrow", 840, 520, 50, 36, 0, 0);
        }
      }           
    } else if(this.page == 0) {
    
      img.draw("title", 0, 0);
      
      if(mouse.isOver(755, 487, 155, 30)) {
        img.drawSprite("menu", 750, 482, 160, 40, 1, 0);
      } else {
        img.drawSprite("menu", 750, 482, 160, 40, 0, 0);
      }
      
      if(mouse.isOver(798, 527, 112, 30)) {
        img.drawSprite("menu", 750, 522, 160, 40, 1, 1);
      } else {
        img.drawSprite("menu", 750, 522, 160, 40, 0, 1);
      }
      
      
    } else if(this.page == 2) {
      
      img.draw("credits", 0, 0);
      
      if(mouse.isOver(820, 527, 90, 30)) {
        img.drawSprite("menu", 750, 522, 160, 40, 1, 2);
      } else {
        img.drawSprite("menu", 750, 522, 160, 40, 0, 2);
      }
      
    }
  };
  
}